Skip to content

Conversation

@ryoppippi
Copy link
Member

@ryoppippi ryoppippi commented Aug 12, 2025

Summary

  • Replaced test skipping with proper network mocking using the responses library
  • Tests now mock StackOne API endpoints instead of making real API calls
  • Examples are imported and executed directly to enable mocking within the test process

Changes

  • Added responses library as a dev dependency for HTTP request mocking
  • Modified test execution from subprocess to direct module import (required for mocking to work)
  • Mock API responses for index.py and file_uploads.py examples
  • Only skip tests when optional dependencies (openai, langchain_openai, crewai) are not installed

Test Results

All tests pass successfully with mocking enabled:

  • 38 tests pass
  • 3 tests skipped (due to missing optional dependencies)
  • No real API calls are made during testing

Benefits

  • Tests are more reliable and do not depend on external API availability
  • Faster test execution
  • No need for valid API keys or account IDs in CI/CD
  • Better test coverage of example files

Summary by cubic

Tests for example files now use network mocking with the responses library, so no real API calls are made and tests run faster and more reliably.

  • Testing Improvements
  • Mocked StackOne API endpoints for index.py and file_uploads.py examples.
  • Tests import and run example modules directly to enable mocking.
  • Only skip tests if optional dependencies are missing.

- Add responses library for HTTP mocking

- Mock StackOne API calls in tests instead of skipping

- Import and execute examples directly to enable mocking

- Skip only when optional dependencies are missing
- Remove unused imports (os, Any)

- Remove trailing whitespace

- Remove whitespace from blank lines
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic analysis

No issues found across 7 files. Review in cubic

@ryoppippi ryoppippi requested a review from mattzcarey August 12, 2025 11:14
@ryoppippi ryoppippi merged commit e510f43 into main Aug 13, 2025
2 checks passed
@ryoppippi ryoppippi deleted the test/add-network-mocking branch August 13, 2025 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants